import GC from '@grapecity/spread-sheets';
import { checkStrategy } from './import/checkArch'
export class PercentageFormatter extends GC.Spread.Formatter.FormatterBase {
    fiexedNum:number
    constructor(fiexedNum:number) {
        super()
        this.fiexedNum = fiexedNum || 2
        
    }

    format(str: string): string {
        if (checkStrategy.isNumber(str)) {
            return (Number(str)).toFixed(this.fiexedNum) + '%'
        }

        return "INVAILD VALUE"
    }

    parse(str: string) {
        return new GC.Spread.Formatter.GeneralFormatter().parse(str,this.fiexedNum);
    }
}